<?php
namespace app\admin\controller;

use app\admin\controller\Base;
// use think\Controller;
class Index extends Base
{
    public function index()
    {
        // 跳转到用户可访问的第一个页面
        $skip_list = ['Index/index'];
        foreach ($this->menu_tree as $key => $menu_item) {
            if(!empty($menu_item['name']) && !in_array($menu_item['name'], $skip_list)){
                $this->redirect($menu_item['name']);
            }
            if(!isset($menu_item['children']) || empty($menu_item['children'])){
                continue;
            }
            foreach ($menu_item['children'] as $key => $child) {
                if(!empty($child['name']) && !in_array($child['name'], $skip_list)){
                    $this->redirect($child['name']);
                }
            }
        }
        return $this->fetch();
    }
}
